<template>
  <div>
    <div class="header">
      <span>交易报表</span>
      <Icon type="ios-arrow-back" size="18" style="position: absolute;left: 10px;" @click="back" />
    </div>
    <div class="mt10 bottoms">
      <div class="bo-list">
        <div class="bo" @click="toP('mobileCurrent')">
          <div class="bo-left text-left"><span>交易列表</span></div>
          <div class="bo-rightt text-right">
            <Icon type="ios-arrow-forward" />
          </div>
        </div>
        <div class="bo" @click="toP('mobileRujin')">
          <div class="bo-left text-left"><span>入金记录</span></div>
          <div class="bo-rightt text-right">
            <Icon type="ios-arrow-forward" />
          </div>
        </div>
        <div class="bo" @click="toP('mobileChujin')">
          <div class="bo-left text-left"><span>出金记录</span></div>
          <div class="bo-rightt text-right">
            <Icon type="ios-arrow-forward" />
          </div>
        </div>
        <div class="bo" @click="toP('mobileTransferdetail')">
          <div class="bo-left text-left"><span>账户流水</span></div>
          <div class="bo-rightt text-right">
            <Icon type="ios-arrow-forward" />
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Mine",
  data() {
    return {
      user: {},
      totalUSDT: "",
      tableMoneyShow: [],
      moneyInfo: {}
    }
  },
  created() {
    this.init()
    this.getMoney()
  },
  methods: {
    back() {
      this.$router.back()
    },
    toP(url) {
      this.$router.push("/" + url)
    },
    init() {
      this.$http
          .get("/api/getAccountInfo?token=" + sessionStorage.getItem("token"))
          .then(response => {
            var resp = response.body;
            if (resp.code == 200) {
              this.user = resp.data;
            } else {
              this.$Message.error(this.loginmsg);
              // this.$Message.error(this.$t('common.logintip'));
            }
          });
    },
    getMoney() {
      //获取
      this.$http.get( "/api/getWallet?token=" + sessionStorage.getItem('token')).then(response => {
        var resp = response.body;
        if(resp.code === 200) {
          const json = resp.data
          this.totalUSDT = (json.m + json.allocation).toFixed(2)
          this.moneyInfo = resp.data
          this.tableMoneyShow = [
            {
              name: "MYR",
              balance: json.m,
              balance2: json.m - json.allocation
            },
            {
              name: "BTC",
              balance: json.BTC
            },
            {
              name: "SGD",
              balance: json.SGD
            },
            {
              name: "USD",
              balance: json.USD
            }
          ]
        }
        console.log(resp)
      });
    },

  }
}
</script>

<style scoped>
.header {
  text-align: center;
  position: relative;
  padding: 10px;
  font-size: 18px;
}
.mt10 {
  margin-top: 10px;
}
.tops, .info {
  display: flex;
  justify-content: center;
}
.infodiv {
  width: 94%;
}
.content {
  width: 94%;
  height: 135px;
  background: url("../../assets/images/minebg.png") no-repeat top;
  background-size: 100% 100%;
  box-sizing: border-box;
  padding: 15px;
  font-size: 14px;
}
.username {
  color: #f1f0f5;
  font-size: 18px;
}
.nickname {
  font-size: 14px;
  color: #8b8896;
}
.mt20 {
  margin-top: 20px;
}
.flex {
  display: flex;
}
.text-left {
  text-align: left;
}
.text-right {
  text-align: right;
}
.btn {
  font-size: 0.75rem;
  text-align: center;
  line-height: 1.063rem;
  width: 4.063rem;
  height: 1.625rem;
  line-height: 1.438rem;
  border: 1px solid #78c1fd;
  border-radius: 1rem;
  background-color: #41a6fc;
  margin-right: 0.625rem;
}
.bo-list {
  padding: 10px 15px;
}
.bo {
  display: flex;
  /*border-top: 1px solid #fff;*/
  padding: 10px 5px;
  background-color: #424242;
}
.bo +.bo{
  margin-top: 5px;
}
.bo-left {
  width: 90%;
}
.bo-rightt {
  flex: 1;
}
</style>